/*
 * Main.c
 *
 *  Created on: 2011-7-5
 *      Author: gexiao
 */
/*
 * The entry of the VM.
 */
#include "DalvikMain.h"

#include <limits.h>
#include <stdio.h>
#include <string.h>

int main(void) {

	const char* path = "";
	char* jarName = "";
	char* mainJavaClassName;
	int argc = 5;
	char* argv[argc];
	argv[0] = "Java";
	argv[1] = "-cp";
	char foopath[PATH_MAX];
	snprintf(foopath,sizeof(foopath),"%s/%s",path,jarName);

	argv[2] = foopath;

	const char* bcpHeader = "-Xbootclasspath:";

	char bootclasspath[5 * PATH_MAX + strlen(bcpHeader) + 5];
	snprintf(bootclasspath,sizeof(bootclasspath),"%s%s/core.jar:%s/ext.jar:%s/framework.jar:%s/android.policy.jar:%s/services.jar",bcpHeader, path, path, path, path, path);

	argv[3] = bootclasspath;
	argv[4] = mainJavaClassName;

	dalvikMain(argc, argv);
	return 0;
}

